//
// Created by vista on 2017/12/10.
//

#ifndef P_P9_H
#define P_P9_H

#include <vector>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <iostream>
using namespace std;

class Solution {
public:
    bool isPalindrome(int x) {

        auto xx = std::abs((long)x);

        long yy = 0;

        if(xx == 0)
            return true;

        if(xx % 10 == 0)
            return false;

        do{
            yy = yy * 10 + xx%10;
            xx /= 10;
        }while (xx != 0);

        return yy == x;
    }
};
#endif //P_P9_H
